package models

import (
	"gorm.io/gorm"
	"video/video-srv/desic/config"
)

type Video struct {
	gorm.Model
	VideoTitle string `gorm:"type:varchar(50);index;comment:'视频标题'"`
	Static     string `gorm:"type:varchar(50);index;comment:'类型'"`
	Address    string `gorm:"type:varchar(300);index;comment:'文件地址参数'"`
}
type TvDrama struct {
	gorm.Model
	EpisodeID int    `gorm:"type:int;index;comment:'分集ID'"`
	TitlePlay string `gorm:"type:varchar(50);index;comment:'剧名'"`
	Static    string `gorm:"type:varchar(50);index;comment:'类型'"`
	Producer  string `gorm:"type:varchar(50);index;comment:'制片方'"`
}
type Review struct {
	gorm.Model
	VideoId int    `gorm:"type:int;index;comment:'视频ID'"`
	Static  string `gorm:"type:varchar(50);index;comment:'状态'"`
	Opinion string `gorm:"type:varchar(200);index;comment:'审核意见'"`
}

type VideoVip struct {
	gorm.Model
	UserId     int    `gorm:"type:int;index;comment:用户ID'"`
	Expire     string `gorm:"type:varchar(50);index;comment:'到期时间'"`
	Permission string `gorm:"type:varchar(50);index;comment:'权限'"`
}

func VideoAdd[T any](date *T) error {
	return config.DB.Create(&date).Error
}
func TvDramaAdd[T any](date *T) error {
	return config.DB.Create(&date).Error
}
func ReviewAdd[T any](date *T) error {
	return config.DB.Create(&date).Error
}

func VideoVipAdd[T any](date *T) error {
	return config.DB.Create(&date).Error
}
